package cn.edu.nju.software.zp13.client.assignment3.xmlNodeEntity;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

import cn.edu.nju.software.zp13.client.assignment3.xmlNodeEntity.util.Gender;
import cn.edu.nju.software.zp13.core.annotation.Element;
import cn.edu.nju.software.zp13.core.annotation.TextNode;
import cn.edu.nju.software.zp13.core.xmlNodeEntity.XmlNodeEntity;

@Element(tagName = "nju:personInfo")
public class Profile extends XmlNodeEntity {
	@Element(tagName = "nju:name")
	private String name;
	@Element(tagName = "nju:gender")
	private Gender gender;
	@Element(tagName = "nju:birthday")
	private LocalDate birthday;
	@Element
	private Department department;

	public Gender getGender() {
		return gender;
	}

	@TextNode(fatherTagName = "nju:gender")
	public String genderToString() {
		return this.gender.toString();
	}

	@TextNode(fatherTagName = "nju:birthday")
	public String birthdayToString() {
		return birthday.format(DateTimeFormatter.ISO_DATE);
	}

	public void setGender(Gender gender) {
		this.gender = gender;
	}

	public LocalDate getBirthday() {
		return birthday;
	}

	public void setBirthday(LocalDate date) {
		this.birthday = date;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Department getDepartment() {
		return department;
	}

	public void setDepartment(Department department) {
		this.department = department;
	}

}
